博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
一些自己写的freemaker macro 用来生成网页中的区块
阅读量:7024 次
发布时间:2019-06-28

本文共 1708 字,大约阅读时间需要 5 分钟。

  hot3.png

FreeMaker的宏功能很好,很适合用来做网页。感觉比Samrty也好。

1.面板,view

<#macro panel title=" " class=" " id="" limit=-1 style="" ><#--panel 模板,支持内嵌内容 -->
${title}
<#nested />

调用:

<@c.panel id="list-panel" title="新闻动态" style="min-height:500px;">          hello world

2.列表,这个列表支持内容格式的调整。

<#macro list1 rs showDate=0 date="yyyy年MM月dd日" class=" " truncate=100 id="" style="" emptyText="暂无" ns="" ><#--信息集列表函数rs 信息集showDate 显示日期date 日期样式class 样式名style 样式表id 编号emptyText 当列表是空的时候显示的内容truncate 数字ns:一个过渡变量用来表示空间名字${lastUpdated?string("yyyy-MM-dd HH:mm:ss zzzz")}${lastUpdated?string("EEE, MMM d, ''yy")}${lastUpdated?string("EEEE, MMMM dd, yyyy, hh:mm:ss a'('zzz')'")}--><#assign count = 1 /><#if rs?size gt 0 >	
<#else> ${emptyText}

调用:

 1 直接调用

<@c.list1 rs=list class="list" showDate=1 ns="DOWNLOAD_MES">
2 变更列表样式,---将被替换成${item.FILE_NAME}<@c.list1 rs=list class="list" showDate=1 ns="DOWNLOAD_MES";item >[item.FILE_TYPE]---

3 组合使用panel 和 list

 

<@c.panel id="list-panel" title=path style="min-height:500px;">          <@c.list1 rs=list class="list" showDate=1 ns="DOWNLOAD_MES";item >[${item.FILE_TYPE!""}]---

 

-- END --

转载于:https://my.oschina.net/lxbzj/blog/32235

你可能感兴趣的文章
AMD和Intel的cpu架构的区别
查看>>
关于函数指针的总结
查看>>
whistle.js连接ios手机中https步骤
查看>>
TCP/IP 协议栈 ------ ICMP
查看>>
apache伪静态设置
查看>>
采用PHP函数uniqid生成一个唯一的ID
查看>>
Centos7安装32位库用来安装32位软件程序
查看>>
【HMOI】小C的填数游戏 DP+线段树维护
查看>>
java中23种设计模式之6-适配器模式(adapter pattern)
查看>>
Easy C 编程 in Linux
查看>>
SQL Server 事务语法
查看>>
poj3761(反序表)
查看>>
x86寄存器总结
查看>>
jquery easyui ajax data属性传值方式
查看>>
Elasticsearch分布式机制探究
查看>>
yield-from示例
查看>>
人工智能、机器学习和深度学习的区别与联系?
查看>>
封装了些文件相关的操作
查看>>
把十进制数(long型)分别以二进制和十六进制形式输出,不能使用printf系列。
查看>>
Linux下Makefile的automake生成全攻略
查看>>